<?php
/* @var $this NewsController */
/* @var $model News */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'news-form',
        'htmlOptions'=>array('enctype'=>'multipart/form-data'),
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Поля с <span class="required">*</span> обязательны.</p>

	<?php echo $form->errorSummary($model); ?>
        
        <div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>150)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>
        
	<div class="row">
		<?php echo $form->labelEx($model,'category_id'); ?>
		<?php echo $form->dropDownList($model,'category_id', CategoryNews::getCategoryList()); ?>
		<?php echo $form->error($model,'category_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'image'); ?>
		<?php echo $form->fileField($model,'image'); ?>
		<?php echo $form->error($model,'image'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'short_story'); ?>
		<?php //echo $form->textArea($model,'short_story',array('rows'=>6, 'cols'=>50,'maxlength'=>255)); ?>
            
                <?php $this->widget('ext.editor.CKkceditor', array(
                    'model'=>$model,
                    'attribute'=>'short_story',
					'height'=>'100px',
					'width'=>'100%',
					'filespath' => Yii::app()->basePath.'/../upload/userfiles',
					'filesurl' =>'/upload/userfiles',  								// подставляется при выборе файла с сервера (поле URL)
                    //'language'=>'ru',
                    //'editorTemplate'=>'full',
                )); ?>
		<?php echo $form->error($model,'short_story'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'full_story'); ?>
		<?php //echo $form->textArea($model,'full_story',array('rows'=>6, 'cols'=>50)); ?>
                
                <?php $this->widget('ext.editor.CKkceditor', array(
                    'model'=>$model,
                    'attribute'=>'full_story',
					'height'=>'200px',
					'width'=>'100%',
					'filespath' => Yii::app()->basePath.'/../upload/userfiles',
					'filesurl' =>'/upload/userfiles',  								// подставляется при выборе файла с сервера (поле URL)
                    //'language'=>'ru',
                    //'editorTemplate'=>'full',
                )); ?>
		<?php echo $form->error($model,'full_story'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'date'); ?>
		<?php echo $form->dateField($model,'date'); ?>
		<?php echo $form->error($model,'date'); ?>
	</div>
        
        <div class="row">
		<?php echo $form->labelEx($model,'actual'); ?>
		<?php echo $form->checkBox($model,'actual'); ?>
		<?php echo $form->error($model,'actual'); ?>
	</div>
        
        <div class="row">
		<?php echo $form->labelEx($model,'keywords'); ?>
		<?php echo $form->textArea($model,'keywords',array('rows'=>6, 'cols'=>50,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'keywords'); ?>
	</div>
        
        <div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Добавить' : 'Сохранить'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->